package com.iplant.mes.service.po.ncr;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.base.utils.annotation.join.multi.DBJoinMulti;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.general.CalendarTool;
import com.iplant.basic.service.po.bpm.BPMTaskBase;
import com.iplant.mes.service.mesenum.ncr.NCRResult;

import java.io.Serializable;
import java.util.Calendar;

/**
 * 不合格评审
 *
 * @author YouWang·Peng
 * 2024-1-22 14:17:58
 */
@DBBasePO(TableName = "ncr_task", CheckName = {"Code"}, Name = false,
        CodeAuto = true, CodePrefix = "NCR-{yyMMdd}-", CodeNum = 4, Schemas = DBSchemas.MES)
public class NCRTask extends BPMTaskBase implements Serializable {
    /**
     * 序列号
     */
    private static final long serialVersionUID = 1L;

    public NCRTask() {
        super();
    }

    /**
     * 版本
     */
    @DBField
    public String Version = "A/1";
    /**
     * 表码
     */
    @DBField
    public String TableCode = "HR-CXWJ-803-01-C";
    /**
     * 不合格品名称
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String Product = "";
    /**
     * 产品编号
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String SerialNo = "";
    /**
     * 发生日期
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.geLe, ParamName = "SProductionDatee", ParamName2 =
            "EProductionDate")
    @DBField
    public Calendar ProductionDate = CalendarTool.getDate();
    /**
     * 所属型号
     */
    @DBField
    public String LocoType = "";
    /**
     * 发生单位ID
     */
    @DBCondition
    @DBField
    public int OccurDepartID = 0;
    /**
     * 发生单位名称
     */
    @DBJoin(name = "Name", tableName = "bms_department", tableAsName = "bms_department1", Schemas = DBSchemas.Basic,
            MainTableField = "OccurDepartID")
    public String OccurDepartName = "";
    /**
     * 责任单位ID
     */
    @DBCondition
    @DBField
    public int DutyDepartID = 0;
    /**
     * 责任单位名称
     */
    @DBJoin(name = "Name", tableName = "bms_department", tableAsName = "bms_department2", Schemas = DBSchemas.Basic,
            MainTableField = "DutyDepartID")
    public String DutyDepartName = "";
    /**
     * 不合格数量
     */
    @DBField
    public float Quantity = 0.0f;
    /**
     * 检验数量
     */
    @DBField
    public float Examine = 0.0f;
    /**
     * 送货数量
     */
    @DBField
    public float Delivery = 0.0f;
    /**
     * 不合格状态描述
     */
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBField
    public String NCRDescription = "";

    /**
     * 不合格等级(1A/2B/3C)
     */
    @DBCondition
    @DBField
    public int Grad = 0;
    /**
     * 处理结果
     */
    @DBCondition
    @DBField
    public int Result = 0;
    /**
     * 处理结果文本
     */
    public String ResultText = "";

    /**
     * 图片、文件地址
     */
    @DBField
    public String ImageUrl = "";
    /**
     * 质量工程师ID（多个逗号隔开）
     */
    @DBField
    public String ManagerID = "";
    /**
     * 质量工程师名称
     */
    @DBJoinMulti(Name = "Name", MainTableField = "ManagerID", TableName = "mbs_user", Schemas = DBSchemas.Basic)
    public String ManagerName = "";

    /**
     * 相关部门人员ID，逗号隔开
     */
    @DBField
    public String AuditApproval = "";
    /**
     * 相关部门人员
     */
    @DBJoinMulti(Name = "Name", MainTableField = "AuditApproval", TableName = "mbs_user", Schemas = DBSchemas.Basic)
    public String AuditApprovalNames = "";

    @JsonProperty("Version")
    public String getVersion() {
        return Version;
    }

    public void setVersion(String version) {
        Version = version;
    }

    @JsonProperty("TableCode")
    public String getTableCode() {
        return TableCode;
    }

    public void setTableCode(String tableCode) {
        TableCode = tableCode;
    }

    @JsonProperty("Product")
    public String getProduct() {
        return Product;
    }

    public void setProduct(String product) {
        Product = product;
    }

    @JsonProperty("SerialNo")
    public String getSerialNo() {
        return SerialNo;
    }

    public void setSerialNo(String serialNo) {
        SerialNo = serialNo;
    }

    @JsonProperty("ProductionDate")
    public Calendar getProductionDate() {
        return ProductionDate;
    }

    public void setProductionDate(Calendar productionDate) {
        ProductionDate = productionDate;
    }

    @JsonProperty("LocoType")
    public String getLocoType() {
        return LocoType;
    }

    public void setLocoType(String locoType) {
        LocoType = locoType;
    }

    @JsonProperty("OccurDepartID")
    public int getOccurDepartID() {
        return OccurDepartID;
    }

    public void setOccurDepartID(int occurDepartID) {
        OccurDepartID = occurDepartID;
    }

    @JsonProperty("OccurDepartName")
    public String getOccurDepartName() {
        return OccurDepartName;
    }

    public void setOccurDepartName(String occurDepartName) {
        OccurDepartName = occurDepartName;
    }

    @JsonProperty("DutyDepartID")
    public int getDutyDepartID() {
        return DutyDepartID;
    }

    public void setDutyDepartID(int dutyDepartID) {
        DutyDepartID = dutyDepartID;
    }

    @JsonProperty("DutyDepartName")
    public String getDutyDepartName() {
        return DutyDepartName;
    }

    public void setDutyDepartName(String dutyDepartName) {
        DutyDepartName = dutyDepartName;
    }

    @JsonProperty("Quantity")
    public float getQuantity() {
        return Quantity;
    }

    public void setQuantity(float quantity) {
        Quantity = quantity;
    }

    @JsonProperty("Examine")
    public float getExamine() {
        return Examine;
    }

    public void setExamine(float examine) {
        Examine = examine;
    }

    @JsonProperty("Delivery")
    public float getDelivery() {
        return Delivery;
    }

    public void setDelivery(float delivery) {
        Delivery = delivery;
    }

    @JsonProperty("NCRDescription")
    public String getNCRDescription() {
        return NCRDescription;
    }

    public void setNCRDescription(String NCRDescription) {
        this.NCRDescription = NCRDescription;
    }

    @JsonProperty("Grad")
    public int getGrad() {
        return Grad;
    }

    public void setGrad(int grad) {
        Grad = grad;
    }

    @JsonProperty("Result")
    public int getResult() {
        return Result;
    }

    public void setResult(int result) {
        Result = result;
    }

    @JsonProperty("ResultText")
    public String getResultText() {
        ResultText = NCRResult.getEnumType(Result).getLabel();
        return ResultText;
    }

    public void setResultText(String resultText) {
        ResultText = resultText;
    }

    @JsonProperty("ImageUrl")
    public String getImageUrl() {
        return ImageUrl;
    }

    public void setImageUrl(String imageUrl) {
        ImageUrl = imageUrl;
    }

    @JsonProperty("ManagerID")
    public String getManagerID() {
        return ManagerID;
    }

    public void setManagerID(String managerID) {
        ManagerID = managerID;
    }

    @JsonProperty("ManagerName")
    public String getManagerName() {
        return ManagerName;
    }

    public void setManagerName(String managerName) {
        ManagerName = managerName;
    }

    @JsonProperty("AuditApproval")
    public String getAuditApproval() {
        return AuditApproval;
    }

    public void setAuditApproval(String auditApproval) {
        AuditApproval = auditApproval;
    }

    @JsonProperty("AuditApprovalNames")
    public String getAuditApprovalNames() {
        return AuditApprovalNames;
    }

    public void setAuditApprovalNames(String auditApprovalNames) {
        AuditApprovalNames = auditApprovalNames;
    }
}
